# -*- coding: UTF-8 -*-
# @Author  : icedew
# @File    : decorators.py
# @Time    : 2019-4-29 18:42
from flask import session,redirect,url_for
from functools import wraps
import config

def login_required(func):
    @wraps(func)
    def inner(*args,**kwargs):
        if config.CMS_USER_ID in session:
            return func(*args, **kwargs)
        else:
            return redirect(url_for('cms.login'))
    return inner